package com.chf.service.impl;

import com.chf.bean.UserInfoBean;
import com.chf.dao.UserInfoBeanMapper;
import com.chf.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserService implements IUserService {
    // 依赖注入
    @Resource
    private UserInfoBeanMapper userInfoBeanMapper;
    @Override
    public boolean doLogin(UserInfoBean userInfoBean) {
        // 调用到层进行登录验证业务逻辑处理
        UserInfoBean userInfoBean1 = userInfoBeanMapper.doLogin(userInfoBean);
        System.out.println("mybatis查询结果：" + userInfoBean1);
        return userInfoBean1 != null;
    }
    //用户信息添加
    @Override
    public int insertSelective(UserInfoBean record) {
        return userInfoBeanMapper.insertSelective(record);
    }

    @Override
    public List<UserInfoBean> selectAllInfo() {
        return userInfoBeanMapper.selectAllInfo();
    }

    @Override
    public UserInfoBean selectByPrimaryKey(Integer userid) {
        return userInfoBeanMapper.selectByPrimaryKey(userid);
    }

    @Override
    public List<UserInfoBean> selectUserInfo(UserInfoBean userInfoBean) {
        return userInfoBeanMapper.selectUserInfo(userInfoBean);
    }

    @Override
    public int deleteByPrimaryKey(Integer userid) {
        return userInfoBeanMapper.deleteByPrimaryKey(userid);
    }

    @Override
    public int updateByPrimaryKeySelective(UserInfoBean record) {
        return userInfoBeanMapper.updateByPrimaryKeySelective(record);
    }


    public void setUserInfoBeanMapper(UserInfoBeanMapper userInfoBeanMapper) {
        this.userInfoBeanMapper = userInfoBeanMapper;
    }
}
